﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Itop.YHPC.Model;
using Itop.YHPC.controller;
using System.Collections;
using System.Data;

namespace Itop.YHPC.admin {
    public partial class sysgroupprogAjax :AjaxPage<sysgroupprog> {
        protected override IList<sysgroupprog> onRead() {
            string where = "where groupid='"+Request.QueryString["groupid"]+"'";
            IList list=Global.SqlMapper.GetList("Select", "select a.id,a.GroupID,a.ProgID,b.ProgName from sysprog b,sysgroupprog a where a.progid=b.id and a.groupid='" + Request.QueryString["groupid"] + "'");
            DataTable dt= ConvertHelper.HashTablesToDataTable(list);
           
            return ConvertHelper.ToIList<sysgroupprog>(dt);
        }
        protected override bool onCreate(IList<sysgroupprog> list) {
            foreach (sysgroupprog obj in list) {
                obj.id = obj.CreateID();
                sysgroupprogController.Insert(obj);
            }
            return true;
        }
        protected override bool onUpdate(IList<sysgroupprog> list) {
            foreach (sysgroupprog obj in list) {

                sysgroupprogController.Update(obj);
            }
            return true;
        }

        protected override bool onDelete(IList<sysgroupprog> list) {
            foreach (sysgroupprog obj in list) {
                sysgroupprogController.Delete(obj.id);
            }
            return true;
        }
    }
}
